// 引入 request 文件
import cloudRequest from '@/utils/cloudRequest.js'
import request from '@/utils/request.js'


const requestMethod = request
// 微信登录捏
export const wxLoginB = (data) => {
	return requestMethod({
		url: '/apis/wxLogin',
		method: 'POST',
		data: data,
	})
}

// 获取微信用户信息
export const getUserInf = (data) => {
	return requestMethod({
		url: '/apis/userInfo',
		method: 'GET',
		data: data,
	})
}

// 更新微信用户信息
export const updateUserInf = (data) => {
	return requestMethod({
		url: '/apis/userInfo',
		method: 'POST',
		data: data,
	})
}

export const editUserRole = (data) => {
	return requestMethod({
		url: '/apis/editUserRole',
		method: 'POST',
		data: data,
	})
}

// 新建帖子
export const newPost = (data) => {
	return requestMethod({
		url: '/apis/newPost',
		method: 'POST',
		data: data,
	})
}

// 获取帖子列表
export const getPostsType = (data) => {
	return requestMethod({
		url: '/apis/getPostItems',
		method: 'POST',
		data: data,
	})
}

// 获取帖子详情
export const getPostDetail = (data) => {
	return requestMethod({
		url: '/apis/getPostItemById',
		method: 'GET',
		data: data,
	})
}

// 获取用户帖子列表
export const getPostListByUserId = (data) => {
	return requestMethod({
		url: '/apis/getPostItemByUserId',
		method: 'POST',
		data: data,
	})
}

export const postUpdatePostStatu = (data) => {
	return requestMethod({
		url: '/apis/updatePostItemStatu',
		method: 'POST',
		data: data,
	})
}

// 删除帖子
export const deletePost = (data) => {
	return requestMethod({
		url: '/apis/deletePostItemById',
		method: 'DELETE',
		data,
	})
}

// 评论帖子
export const newComments = (data) => {
	return requestMethod({
		url: '/apis/newComment',
		method: 'POST',
		data: data,
	})
}

//获取帖子所有评论
export const getPostComments = (data) => {
	return requestMethod({
		url: '/apis/getCommentsByPostId',
		method: 'GET',
		data: data,
	})
}

// 获取回复评论
export const getReplyComments = (data) => {
	return requestMethod({
		url: '/apis/getCommentsByCommentId',
		method: 'GET',
		data: data,
	})
}


// 删除评论
export const deleteComments = (data) => {
	return requestMethod({
		url: '/apis/deleteComment',
		method: 'DELETE',
		data,
	})
}

// 上传文件 待调整
export const uploadFiles = (file) => {
	return requestMethod({
		url: '/apis/uploadFiles',
		method: 'POST',
		file: file
	})
}
export const applyClub = (data) => {
	return requestMethod({
		url: '/apis/applyClub',
		method: 'POST',
		data
	})
}


// 获取社团列表
export const getClubs = (data) => {
	return requestMethod({
		url: '/apis/getClubList',
		method: 'POST',
		data: data,
	})
}

// 审核社团建立资质
export const passClub = (data) => {
	return requestMethod({
		url: '/apis/passClub',
		method: 'POST',
		data: data,
	})
}
// 获取社团详情
export const getClubDetail = (data) => {
	return requestMethod({
		url: '/apis/getClubDetail',
		method: 'POST',
		data: data,
	})
}
// 加入社团
export const joinClub = (data) => {
	return requestMethod({
		url: '/apis/joinClub',
		method: 'POST',
		data: data,
	})
}

// 审核社团加入
export const checkJoin = (data) => {
	return requestMethod({
		url: '/apis/checkJoin',
		method: 'POST',
		data: data,
	})
}
//获取用户加入的社团
export const getClubByUserId = (data) => {
	return requestMethod({
		url: '/apis/getClubByUserId',
		method: 'POST',
		data: data,
	})
}
//获取申请加入社团的用户
export const getClubJoinPlz = (data) => {
	return requestMethod({
		url: '/apis/getClubJoinPlz',
		method: 'POST',
		data,
	})
}

export const updateClub = (data) => {
	return requestMethod({
		url: '/apis/updateClub',
		method: 'POST',
		data: data,
	})
}
// 获取社团所有指导老师
export const getTeacherByClubId = (clubId) => {
	return requestMethod({
		url: `/apis/getTeacherByClubId?clubId=${clubId}`,
		method: 'GET',
	})
}